<?PHP

include_once 'controller.php';

session_start();
if (!(isset($_SESSION['login']) && $_SESSION['login'] != '')) {
    header ("Location: login.php");
}

$recipientID = $_POST["userToSend"];
$starAmount = $_POST["starSpinner"];
$comment = $_POST["comment"];
$sender = $_SESSION['userName'];
$senderID = $_SESSION["userID"];

$starInfo[] = array();
$starInfo = getAvailableStarsInfo();
$date = date("Y-m-d H:i:s");
echo $date;

for($row = 0; $row < $starAmount; $row++){
    giveStar($recipientID,$comment,$starInfo[$row][1], $date);
}

header ("Location: index.php");

?>
